//
//  RadioMainTableViewCell.m
//  FoodList
//
//  Created by Jason on 16/4/12.
//  Copyright © 2016年 王金晶. All rights reserved.
//

#import "RadioMainTableViewCell.h"

@implementation RadioMainTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    
    self.titleLab.font = [UIFont systemFontOfSize:returnFont(Height) + 1];
    self.authorLab.font = [UIFont systemFontOfSize:returnFont(Height) - 2];
    self.playCount.font = [UIFont systemFontOfSize:returnFont(Height) - 4];
    self.allCountLab.font = [UIFont systemFontOfSize:returnFont(Height) - 4];
}

- (void)setModel:(RadioMainModel *)model {
    _model = model;
    [self.covreImg sd_setImageWithURL:[NSURL URLWithString:model.cover_path]];
    self.titleLab.text = model.title;
    self.authorLab.text = model.intro;
    NSString *temp = [NSString stringWithFormat:@"%@", model.play];
    NSInteger tem = [model.play integerValue];
    if (temp.length >= 5) {
        self.playCount.text = [NSString stringWithFormat:@"%ld.%ld万", tem / 10000, (tem % 10000) / 1000];
    }else {
        self.playCount.text = [NSString stringWithFormat:@"%@", model.play];
    }
    self.allCountLab.text = [NSString stringWithFormat:@"%@集", model.tracks];
}

- (void)setSec2Model:(PlaySectionTwoModel *)sec2Model {
    _sec2Model = sec2Model;
    [self.covreImg sd_setImageWithURL:[NSURL URLWithString:sec2Model.coverMiddle]];
    self.titleLab.text = sec2Model.title;
    self.authorLab.text = sec2Model.intro;
    
    NSNumber *tempPlay = sec2Model.albumPlays[[NSString stringWithFormat:@"%@", sec2Model.albumId]];
    NSString *playStr = [NSString stringWithFormat:@"%@", tempPlay];
    NSInteger playCounte = [tempPlay integerValue];
    
    if (playStr.length >= 5) {
        self.playCount.text = [NSString stringWithFormat:@"%ld.%ld万", playCounte / 10000, (playCounte % 10000) / 1000];
    }else {
        self.playCount.text = [NSString stringWithFormat:@"%ld", playCounte];
    }
    
    NSNumber *tempTrack = sec2Model.albumTracks[[NSString stringWithFormat:@"%@", sec2Model.albumId]];
    self.allCountLab.text = [NSString stringWithFormat:@"%@集", tempTrack];
    
}



@end
